package com.sunny.l45;

public class Solution {
    public int maxDepth(TreeNode root) {
        return dfs(root);
    }
    public int dfs(TreeNode node){
        if(null == node){
            return 0;
        }
        int left = dfs(node.left);
        int right = dfs(node.right);
        return Integer.max(left, right) + 1;
    }
}

class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;
    TreeNode(int x) { val = x; }
}
